<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<img src="img/1.jpg" id="pic">
		<br><br>
		<button type="button" style="margin-left: 50px;" onclick="qiehuan()" id="btn1">切换图片</button>		
	</body>
	<script type="text/javascript">
	//获取图片对象
	    var pic=document.getElementById('pic')
	    var btn=document.getElementById('btn1')
		
		function qiehuan(){
			var myInerterval = setInterval(function(){
			var imgsz=["img/1.jpg","img/2.jpg","img/3.jpg","img/4.jpg","img/5.jpg","img/6.jpg","img/7.jpg","img/8.jpg","img/9.jpg",]
		    var suiji=Math.floor(Math.random()*imgsz.length)
			pic.src=imgsz[suiji]
		},200)
		}
		
		
	</script>
</html>
